package com.wms.function.service.impl;

import java.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wms.function.mapper.TbCustomerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.json.GsonJsonParser;
import org.springframework.stereotype.Service;
import com.wms.function.domain.TbCustomer;
import com.wms.function.service.ITbCustomerService;
import java.util.Arrays;

/**
 * 客户Service业务层处理
 *
 * @author ruoyi
 * @date 2025-02-19
 */
@Service
public class TbCustomerServiceImpl extends ServiceImpl<TbCustomerMapper,TbCustomer> implements ITbCustomerService {
    @Autowired
    private TbCustomerMapper tbCustomerMapper;

    /**
     * 查询客户
     *
     * @param id 客户主键
     * @return 客户
     */
    @Override
    public TbCustomer selectTbCustomerById(Long id) {
        return getById(id);
    }

    /**
     * 查询客户列表
     *
     * @param tbCustomer 客户
     * @return 客户
     */
    @Override
    public List<TbCustomer> selectTbCustomerList(TbCustomer tbCustomer) {
        return tbCustomerMapper.selectTbCustomerList(tbCustomer);
    }

    /**
     * 新增客户
     *
     * @param tbCustomer 客户
     * @return 结果
     */
    @Override
    public int insertTbCustomer(TbCustomer tbCustomer) {
                                                                return save(tbCustomer) ? 1 : 0;
    }

    /**
     * 修改客户
     *
     * @param tbCustomer 客户
     * @return 结果
     */
    @Override
    public int updateTbCustomer(TbCustomer tbCustomer) {
                                                        return updateById(tbCustomer) ? 1 : 0;
    }

    /**
     * 批量删除客户
     *
     * @param ids 需要删除的客户主键
     * @return 结果
     */
    @Override
    public int deleteTbCustomerByIds(Long[] ids) {
                return removeByIds(Arrays.asList(ids)) ? 1 : 0;
    }

    /**
     * 删除客户信息
     *
     * @param id 客户主键
     * @return 结果
     */
    @Override
    public int deleteTbCustomerById(Long id) {
                return removeById(id) ? 1 : 0;
    }

}
